--- title: "Workshop 2" author: "Dwight Wynne" format: html editor: visual --- ## Quarto Quarto enables you to weave together content and executable code into a finished document. To learn more about Quarto see . ## Running Code When you click the **Render** button a document will be generated that includes both content and the output of embedded code. You can embed code like this: ```{r} 1 + 3 ``` You can add options to executable code like this ```{r} #| echo: false 2 * 2 ``` The `echo: false` option disables the printing of code (only output is displayed). ```{r} library(readxl) plant_data <- read_excel("Downloads/workshop2_plant_data.xlsx") View(plant_data) ``` ```{r} #| label: investigate data library(tidyverse) # load packages we need to look at the data glimpse(plant_data) ``` We would like to plot our data instead of just looking at the values. ```{r} ggplot( data = plant_data, # name of the dataset we want to plot mapping = aes( x = num_petals ) ) + geom_histogram( binwidth = 5, # bar width = 5 center = 12.5, # center of one bar fill = "aquamarine4" ) ``` Heavy amount of data on the left side. ```{r} #| label: create scatterplot ggplot( data = plant_data, mapping = aes( x = `height (cm)`, y = num_petals, color = genus ) ) + geom_point() ``` ```{r} #| label: side-by-side boxplot ggplot( data = plant_data, mapping = aes( x = genus, # genus as grouping variable y = num_petals, # number petals as outcome of interest fill = genus # box colors based on genus ) ) + geom_boxplot() + coord_flip() # makes it horizontal ```